﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using TouristAgencyDataLayer;

namespace TouristAgencyAsp
{
    public partial class AddPerson : System.Web.UI.Page
    {
        protected void Page_Load(object sender, EventArgs e)
        {

        }

        protected void addBtn_Click(object sender, EventArgs e)
        {
            string id = Request.Params["tourId"];

            if(id != null)
            {
                int perId = Persons.CreatePerson(this.fNameTxt.Text, this.lNameTxt.Text, this.passNumTxt.Text);

                if (perId != -1)
                {
                    Response.Redirect(string.Format("~/MakeReservation.aspx?tourId={0}&perId={1}", id, perId));
                }
            }
        }
    }
}